import request from '@/utils/request'

export function getEmployeeSimple() {
  return request({
    url: '/sys/user/simple',
    method: 'GET'
  })
}

// 获取员工列表
// params: {page, size}
export function getEmployees(params) {
  return request({
    url: '/sys/user',
    method: 'GET',
    params
  })
}

// 删除员工
export function delEmployee(id) {
  return request({
    url: '/sys/user/' + id,
    method: 'DELETE'
  })
}

// 添加员工
export function addEmployee(data) {
  return request({
    url: '/sys/user',
    method: 'POST',
    'data': data
  })
}

// 批量添加员工
export function importEmployee(data) {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    'data': data
  })
}

// 获取员工详情
export function getEmployeeById(id) {
  return request({
    url: '/sys/user/' + id
  })
}

// 更新员工详情
export function updateEmployeeById(data) {
  return request({
    url: '/sys/user/' + data.id,
    method: 'PUT',
    data
  })
}

//  给员工分配角色 {id:xx ,roleIds: []}
export function updateRole(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'PUT',
    data
  })
}

